#pragma once

class NextOnFreeList
{
public:
	NextOnFreeList* next;
};

#define _POOL

class Rational
{
public:
	Rational(int a = 0, int b = 1) : n(a), d(b)
	{
	}
	~Rational()
	{
	}
#ifdef _POOL
	void* operator new(size_t size);
	void operator delete(void* doomed, size_t size);
#endif
	static void newMemPool() {expandTheFreeList();}
	static void deleteMemPool();
private:
	static NextOnFreeList* freelist;
	static void expandTheFreeList();
	enum {EXPANSION_SIZE = 100};
	int n;
	int d;
	int mmm[100000];
};
